#pragma once
#include "Buffer.h"
#include "../external/external.h"
namespace Nitro::Renderer {

enum TextureWrapping
{
    Repeat = 0x2901,
    MirroredRepeat = 0x8370,
    ClampToEdge = 0x812F,
    ClampToBorder = 0x812D,
};

enum TextureFilter
{
    Nearest = 0x2600,
    Linear = 0x2601,
    // Mipmap only for mag filter
    NearestMipmapNearest = 0x2700,
    LinearMipmapNearest = 0x2701,
    NearestMipmapLinear = 0x2702,
    LinearMipmapLinear = 0x2703,
};

struct SourceImageDescriptor
{
    int16_t width;
    int16_t height;
    Format format;
    const void* data = nullptr;
};

struct TextureDescriptor2D
{
    TextureWrapping wrappingX = Repeat;
    TextureWrapping wrappingY = Repeat;
    TextureFilter minFilter = Nearest;
    TextureFilter magFilter = Linear;
};

struct Texture2D
{
    void generateMipmap();
    uint32_t id = 0;
};

Texture2D CreateTexture2D(const TextureDescriptor2D& texDesc,
                          const SourceImageDescriptor& srcDesc);

}; // namespace Nitro::Renderer